Caption = "Look in the Form_Load procedure to see how it's done."
Height = 1215
Left = 2280
TabIndex = 2
Top = 1440
Width = 1695
End
Begin VB.Label Label1
Caption = "This sample shows how to use the Windows API to disable list painting while adding items. "
Height = 1095
Left = 2280
TabIndex = 1
Top = 240
Width = 1695
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_SETREDRAW = &HB
Private Sub Form_Load()
Dim i As Integer
Me.Left = (Screen.Width - Me.ScaleWidth) / 2
Me.Top = (Screen.Height - Me.ScaleHeight) * 2 / 5
Me.Show
DoEvents
' turn off redraw
Call SendMessage(MList1.hwnd, WM_SETREDRAW, 0, 0)
For i = 1 To 1000
MList1.AddItem "foo" & i
Next
' turn redraw back on, the control redraws automatically